package com.chinaunicom.create.prototype.shallowcopy;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/7/19 9:59
 * Description:
 */
public class Client {
    

    public static void main(String[] args) {
        Realizetype realizetype = new Realizetype();
        realizetype.setAddress("陕西省西安市未央区欧亚大道108号");
        realizetype.setName("张三");
        SDept SDept = new SDept();
        realizetype.setDept(SDept);

        Realizetype cloneRealizetype = realizetype.clone();

        System.out.println("属性address的hashCode: "+realizetype.getAddress().hashCode()+ "----: " + cloneRealizetype.getAddress().hashCode());
        System.out.println("属性name的hashCode: "+realizetype.getName().hashCode()+ "----: " + cloneRealizetype.getName().hashCode());
        System.out.println("属性dept的hashCode: "+realizetype.getDept().hashCode()+ "----: " + cloneRealizetype.getDept().hashCode());
        System.out.println("对象hashCode: "+realizetype.hashCode() + "----: " + cloneRealizetype.hashCode());

        System.out.println("------------------------------");
        // 复制完成之后对被克隆数据进行修改
        SDept.setDeptName("测试部门");
        SDept.setDeptAdd("江苏南京");
        System.out.println(realizetype.toString());
        System.out.println(cloneRealizetype.toString());
        
        
        System.out.println("------------------------------");
        // 复制完成之后对克隆数据进行修改
        cloneRealizetype.setName("李四");
        cloneRealizetype.setAddress("北京总部");

        System.out.println(realizetype.toString());
        System.out.println(cloneRealizetype.toString());
        
    }
}
